﻿using ARchGL.Platform.Utils;
using Microsoft.AspNetCore.Hosting;
using System;
using System.Collections.Generic;
using System.IO;

namespace ARchGL.Platform.Web.Startup
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //TestMethod(); return;

            CreateWebHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args)
        {
            return new WebHostBuilder()
                .UseKestrel(opt => opt.AddServerHeader = false)
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                //.UseUrls("http://0.0.0.0:7003")
                //.UseUrls(args)
                .UseStartup<Startup>();
        }

        public static void TestMethod()
        {
            {
                var dict = new Dictionary<int, string>()
                {
                    { 1, "Item1"},
                    { 2, "Item2"},
                    { 3, "Item3"},
                    { 4, "Item3-1"},
                    { 5, "Item3-2"},
                    { 6, "Item3-3"},
                };

                foreach (var item in dict)
                {
                    if (item.Value.Contains("3"))
                        dict.Remove(item.Key);
                }

                Console.WriteLine(string.Join(",", dict.Values));
            }
            return;
            {
                var list = new List<string>() { "Item1", "Item2", "Item3", "Item3-1", "Item3-2", "Item3-3" };
                var count = list.RemoveAll(x => x.Contains("3"));

                //var clone = list;
                //Console.WriteLine(clone == list);
                //Console.WriteLine(ReferenceEquals(clone, list));
                //Console.WriteLine(ReferenceEquals(clone, list.Clone()));

                //foreach (var item in clone)
                //{
                //    if (item.Contains("3"))
                //        list.Remove(item);
                //}

                Console.WriteLine(count);
                Console.WriteLine(string.Join(",", list));
            }
        }
    }
}
